package Merlion.CRM.entity;

import Merlion.MRP.entity.BackOrderEntity;
import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public abstract class SalesDocumentEntity implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dateIssued;
    private String documentName;
    private String deleteFlag = "N";//"Y"/"N"
    private String documentType;//"SI/QN/PO/SO"
    private String description = "";
    private boolean reserved;
    private String pricingType;
    @ManyToOne
    private ClientEntity client;
    @ManyToOne
    private ContactEntity contact;
    @OneToMany
    private Collection<LineEntryEntity> lineEntryList;
    @OneToOne
    private BillingAddressEntity billingAddress;
    @OneToOne
    private ShippingAddressEntity shippingAddress;
    @OneToOne
    private BackOrderEntity backOrder;

    //  public SalesDocumentEntity(){}
    public void create(Collection<LineEntryEntity> lineEntryList, Date dateIssued, String documentType,
            ClientEntity client) {
        this.setDateIssued(dateIssued);
        this.setDeleteFlag(deleteFlag);
        this.setDocumentType(documentType);
        this.setClient(client);
        this.setLineEntryList(lineEntryList);
    }

    public ClientEntity getClient() {
        return client;
    }

    public void setClient(ClientEntity client) {
        this.client = client;
    }

    public Collection<LineEntryEntity> getLineEntryList() {
        return lineEntryList;
    }

    public void setLineEntryList(Collection<LineEntryEntity> lineEntryList) {
        this.lineEntryList = lineEntryList;
    }

    public Date getDateIssued() {
        return dateIssued;
    }

    public void setDateIssued(Date dateIssued) {
        this.dateIssued = dateIssued;
    }

    public BackOrderEntity getBackOrder() {
        return backOrder;
    }

    public void setBackOrder(BackOrderEntity backOrder) {
        this.backOrder = backOrder;
    }

    public String getDeleteFlag() {
        return deleteFlag;
    }

    public void setDeleteFlag(String deleteFlag) {
        this.deleteFlag = deleteFlag;
    }

    public String getDocumentType() {
        return documentType;
    }

    public void setDocumentType(String documentType) {
        this.documentType = documentType;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public BillingAddressEntity getBillingAddress() {
        return billingAddress;
    }

    public void setBillingAddress(BillingAddressEntity billingAddress) {
        this.billingAddress = billingAddress;
    }

    public ShippingAddressEntity getShippingAddress() {
        return shippingAddress;
    }

    public void setShippingAddress(ShippingAddressEntity shippingAddress) {
        this.shippingAddress = shippingAddress;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public boolean isReserved() {
        return reserved;
    }

    public void setReserved(boolean reserved) {
        this.reserved = reserved;
    }

    public String getDocumentName() {
        return documentName;
    }

    public void setDocumentName(String documentName) {
        this.documentName = documentName;
    }

    public String getPricingType() {
        return pricingType;
    }

    public void setPricingType(String pricingType) {
        this.pricingType = pricingType;
    }

    public ContactEntity getContact() {
        return contact;
    }

    public void setContact(ContactEntity contact) {
        this.contact = contact;
    }
}
